let io
module.exports = function (app) {

  io = require('socket.io')(app);
  io.on('connection', function (socket) {

    hello(socket)
  });

}

function hello(socket) {
  socket.on('join', function (data) {
    io.sockets.emit('news', { hello: '欢迎' + data.name });
  });
}